package datacontracts;

import java.util.ArrayList;

public class CrawledPage {

	private String rootUrl;
	boolean isRootValid;
	private ArrayList<SubLink> sublinkList = new ArrayList<CrawledPage.SubLink>();
	private ArrayList<ExternalLink> extLinkList = new ArrayList<CrawledPage.ExternalLink>();

	public CrawledPage(String _url) {
		rootUrl = _url;
		isRootValid = false;
	}

	public String getRootUrl() {
		return rootUrl;
	}

	public void setRootValidity(boolean value) {
		isRootValid = value;
	}

	public boolean isRootValid() {
		return isRootValid;
	}

	public void addSublink(SubLink link) {
		sublinkList.add(link);
	}

	public void addExtLink(ExternalLink link) {
		extLinkList.add(link);
	}

	public ArrayList<ExternalLink> getExtLinks() {
		return extLinkList;
	}

	public ArrayList<SubLink> getSublinks() {
		return sublinkList;
	}

	public class SubLink {
		private String subLink;
		private boolean isLinkValid;
		private ArrayList<SubLink> sublinkList = new ArrayList<CrawledPage.SubLink>();

		public SubLink(String link) {
			subLink = link;
			isLinkValid = false;
		}

		public void setLinkValidity(boolean value) {
			isLinkValid = value;
		}

		public boolean isLinkValid() {
			return isLinkValid;
		}

		public String getSublink() {
			return subLink;
		}

		public void addSublink(SubLink link) {
			sublinkList.add(link);
		}

		public ArrayList<SubLink> getSublinks() {
			return sublinkList;
		}

	}

	public class ExternalLink {
		private String externalLink;
		private boolean isLinkValid;

		public ExternalLink(String extLink) {
			externalLink = extLink;
		}

		public void setLinkValidity(boolean value) {
			isLinkValid = value;
		}

		public String getExternalLink() {
			return externalLink;
		}

		public boolean isLinkValid() {
			return isLinkValid;
		}

	}

}
